﻿// console.log('index Version: 2.3, 2018/3/19');
var self = this;
var mySwiper;
var debug = GetQueryString('debug');
var qrCode = GetQueryString('s'), // 寻车url后缀startID以及endID
	// pathMode = false,
	startFloor, //寻车url后缀起点楼层
	endFloor, //寻车url后缀终点楼层
	urlEnd, //寻车url后缀终点NodeID
	urlStart; //寻车url后缀起点NodeID
var floorsData = []
var getPathFloor = []; //存起点和终点的数组 
var saveFloor = []; // 存后台请求出来的所有楼层 
var saveCompareGet = []; // 存有路线的楼层 
var getToggleFloor = []; // 存切换模块的楼层 
var fFloor; //起点路径楼层号    1F
var mFloor; //中间路径楼层号
var lFloor; //终点路径楼层号
var fIndex; //起点路径楼层index
var mIndex; //中间路径楼层index
var lIndex; //终点路径楼层index
var fFloorid; //起点路径楼层id   模拟导航开头调用一次 self.map.showFloors(fFloorid)
var isInit = true; //是否是初始化
var mFloorid; //中间路径楼层id
var lFloorid; //终点路径楼层id
var msgLength; //msg的字段长度
var textO;
var dataO;
var nowFloorNo
var isPathGo = false;
var nowFloorId; //模拟导航内调用 拿到后台请求的当前所在的楼层   模拟导航方法内的regNavigationWalk方法内 调用一次nowFloorId = walkDetail.floorID;   取消模拟导航方法开头 调用一次$('.floorToggle').html("" + object.flooridFloors[nowFloorId] + "");
var arrT = []; //导航状态下  左侧按钮的楼层遍历出来楼层号
var isFloorToggleCounter = false; //楼层切换计数器开关，暂时用于处理当同层不同区导航时暂停后跳转的bug的属性   onSelected方法内的regNavigationPause方法内 调用一次isFloorToggleCounter = true; 继续模拟导航方法尾部 调用一次isFloorToggleCounter = false;
var floorCounter = 0; //楼层切换计数器   继续模拟导航方法尾部 调用一次floorCounter = 0;
var object = {
	startPP: '', //设置起点时获取的起点楼层号   setStart方法内 调用一次object.startPP = object.flooridFloors[data.floorID] goBack方法开头和startP做相同格式判断
	endPP: '', //设置终点时获取的终点楼层号     setEnd方法内 调用一次object.endPP = object.flooridFloors[data.floorID] goBack方法开头和endP做相同格式判断
}
var isShowLocateTip = true;
var shopShowLocation = true;
var oldFloorid;
var historyList = []
var isMogo;
var floorKey;
var isPathFinding = false;
//https://www.cloudindoormap.com/testifs/?mac=74:d2:1d:13:e4:33
var object = {
	startP: '',
	endP: '',
	xlId: {},
	searchList: '',
	shopList: [],
	isBlock: true,
	flagAudio: true,
	floorid: GetQueryString('floorid') ? GetQueryString('floorid') : MapConfig.initFloorID,
	mark: GetQueryString('mark'),
	mac: GetQueryString('mac'),
	ip: GetQueryString('ip'),
	endMark: GetQueryString('e'), //终点标记
	flag: true,
	floorData: '',
	orderFloors: {},
	flooridFloors: {}, //方便楼层处理
	flooridOrder: {},
	floorOrder: {},
	floorNameId: {},
	pointNames: {},
	order: 5,
	flags: true,
	ispoint: true,
	isInitOrder: true,
	location: false,
	timer: '',
	timers: '',
	flagClearInterval: true,
	pathfinding: JSON.parse(GetQueryString('pathfinding')),
	shopID: GetQueryString('shopID'),
	isSwiper: false,
	navigationInterval: '',
	moFloorid: {
		start: '',
		end: '',
		startArea: '',
		endArea: ''
	},
	isOperation: true,
	isShop: true,
	isPause: false,
	flagSearch: false,
	flagShare: true,
	getServeData: function (data, fn) { //获取数据
		$.ajax({
			type: "GET",
			url: object.url,
			data: data,
			dataType: "JSONP",
			success: function (s) {
				fn(s);
			}
		});
	},
	url: "https://map.ckiosk.cn/WebAPI/ClientService.asmx/Command?callback",
	audioEnd: true,
	isAudio: true,
	oldFloorid: '',
	deBug: false,
	locationCenter: true,
	distance: "",
	ispathGoer: true

};

var config = {
	flagMark: true,
	floorNumber: 14,
	Project: '261FDAD7-33F9-40A4-BD33-25F1C884F54C', //统计访问次数
	ReacordValue: 'https://www.cloudindoormap.com/ifs', //统计访问网站次数参数
	deBug: false
}


$(document).ready(function () {
	$("title").html(MapConfig.title);
	$.ajax({
		type: 'GET',
		url: 'https://service.chaunve.com/RecordWebService.asmx/Record?Project=' + config.Project + '&Type=CLOUDMAP&ReacordValue=' + config.ReacordValue + '&AccessFrom=',
		success: function (s) {}
	})
	if (object.pathfinding) {
		object.floorid = object.pathfinding.sFid;
	}
	if (object.mark) {

	} else if (object.shopID) {
		object.flagClearInterval = false
		for (var i = 0; i < L.length; i++) {
			if (object.shopID.indexOf(L[i].name) != -1) {
				object.order = L.length - Number(L[i].order)
				object.floorid = L[i].floorID;
				// object.oldFloorid = L[i].floorID;
				break;
			}
		}
	}
	init(object.floorid)
	spanBtn()
	historyBtn()
	var mySwipers = new Swiper('.swiper-container4', {
		direction: 'vertical',
		slidesPerView: 'auto',
		initialSlide: 0,
		// slideToClickedSlide: true,
		observer: true, //修改swiper自己或子元素时，自动初始化swiper
		observeParents: true,
		init: true

	})
});
// 去掉手机端的alert弹出网站
window.alert = function (name) {
	var iframe = document.createElement("IFRAME");
	iframe.style.display = "none";
	iframe.setAttribute("src", 'data:text/plain,');
	document.documentElement.appendChild(iframe);
	window.frames[0].window.alert(name);
	iframe.parentNode.removeChild(iframe);
};


//起始点和终点交换
function reverse() {
	var middleID, middleVal, middlePathID;
	self.map.reset();
	reverseInside()
	if (qrCode) {
		[self.map.startPID, self.map.endPID] = [self.map.endPID, self.map.startPID];
		middleVal = $('#startPoint').val();
		$('#startPoint').val($('#endPoint').val());
		$('#endPoint').val(middleVal);


		object.startP = self.map.setStartArea(self.map.startPID, true);
		object.endP = self.map.setEndArea(self.map.endPID, true);


		$('.setPoint1').css('display', 'block');
		if (object.startP && object.endP) {
			$('.floorToggle,.floorToggleMinUl,.scale').css('bottom', '3rem');
			$(".floorToggleUlBox").css('bottom', '2.8rem')
			$('.tishi').html('点击开始导航');
			$('.go').removeAttr("disabled").css('backgroundColor', '#a6937c');
		}
		pathGo();
	} else {
		if (isPathFinding) {
			middleID = object.moFloorid.start;
			object.moFloorid.start = object.moFloorid.end;
			object.moFloorid.end = middleID;
			// console.log(object.xlId.startId)
			middlePathID = object.pathfinding.sId;
			object.pathfinding.sId = object.pathfinding.eId;
			object.pathfinding.eId = middlePathID;
			middleVal = $('#startPoint').val();
			$('#startPoint').val($('#endPoint').val());
			$('#endPoint').val(middleVal);
			object.startP = self.map.startNode.pointID = object.pathfinding.sId;
			object.endP = self.map.endNode.pointID = object.pathfinding.eId;
			self.map.addMarkToPoint(object.pathfinding.sId, 'start')
			self.map.addMarkToPoint(object.pathfinding.eId, 'end')
			pathGo();
		} else {

			if ($('#endPoint').val().length != 0 && $('#startPoint').val().length != 0) {
				middleID = object.xlId.startId;
				object.xlId.startId = object.xlId.endId;
				object.xlId.endId = middleID;


				middleVal = $('#startPoint').val();
				$('#startPoint').val($('#endPoint').val());
				$('#endPoint').val(middleVal);


				object.startP = self.map.setStartArea(object.xlId.startId, true);
				object.endP = self.map.setEndArea(object.xlId.endId, true);
				$('.setPoint1').css('display', 'block');
				if (object.startP && object.endP) {
					$('.floorToggle,.floorToggleMinUl,.scale').css('bottom', '3rem');
					$(".floorToggleUlBox").css('bottom', '2.8rem')
					$('.tishi').html('点击开始导航');
					$('.go').removeAttr("disabled").css('backgroundColor', '#a6937c');
				}
				pathGo();

			} else if ($('#startPoint').val().length != 0 && $('#endPoint').val().length == 0) {
				object.xlId.endId = object.xlId.startId;
				object.xlId.startId = '';


				$('#endPoint').val($('#startPoint').val());
				$('#startPoint').val('');


				object.startP = self.map.setStartArea(object.xlId.startId, true);
				object.endP = self.map.setEndArea(object.xlId.endId, true);
			} else if ($('#startPoint').val().length == 0 && $('#endPoint').val().length != 0) {
				object.xlId.startId = object.xlId.endId;
				object.xlId.endId = '';


				$('#startPoint').val($('#endPoint').val());
				$('#endPoint').val('');

				object.startP = self.map.setStartArea(object.xlId.startId, true);
				object.endP = self.map.setEndArea(object.xlId.endId, true);
			}

		}


	}

}


// 在二维码存在的情况下将赋值url后缀startID、endID以及floorName
if (qrCode) {
	var urlimg = qrCode;
	endFloor = urlimg.split('|')[3]
	startFloor = urlimg.split('|')[2];
	urlEnd = urlimg.split('|')[1];
	urlStart = urlimg.split('|')[0];
}





//地图初始化参数配置
function init($floorid) {

	// 文本显示层级   数值越大  越容易显示
	GIM.SHOW_SPRITE_LENGTH = MapConfig.SHOW_SPRITE_LENGTH;
	/* 公共设施显示层级 */
	GIM.SHOW_Facility_LENGTH = MapConfig.SHOW_Facility_LENGTH;
	GIM.DEBUG_MODE = MapConfig.degug; //是否开启调试，true为开启，false为u开启，默认不开启
	GIM.far = MapConfig.far;
	var container = document.getElementById('mapContainer')
	container.style.cssText = "width:" + (container.clientWidth / 1) + "px;height:" + (container.clientHeight / 1) + "px;text-align:right";
	var params = {
		isTextColorWrite: MapConfig.TextColorWhite,
		initCompleted: initCompelte,
		onSelected: onSelected,
		container: container,
		themeID: MapConfig.themeID,
		enabledControl: true,
		backgroundColor: MapConfig.backgroundColor,
		showLabelType: "shopName",
		labelScale: MapConfig.labelScale,
		groundLayer: MapConfig.groundLayer,
		initFloorID: MapConfig.initFloorID,
		projectID: MapConfig.projectID,
		cloudID: MapConfig.cloudID,
		accessToken: MapConfig.accessToken,
		opacity: MapConfig.opacity, //具有高度块的透明度
		groundLayer: MapConfig.groundLaye, //是否设置地图底图 布尔值
		bgisSvg: MapConfig.bgisSvg // 底图是否是svg  布尔值
	};
	self.map = new GIM.Map3D(params);
	self.map.zoomLevel(MapConfig.zoomlevel);
	self.map.selectedColor = 0x712891;
	self.map.pathThickness = MapConfig.pathThickness;
	self.map.move2Point(MapConfig.movePosition);

	self.map.setPolarAngle(MapConfig.PolarAngle);
	self.map.setAzimuthalAngle(MapConfig.AzimuthalAngle);
	self.map.pathGap = 3;
	self.map.showCompass(MapConfig.compass);
	self.map.setBackgroundURL(MapConfig.bgurl, MapConfig.bgScale)
	self.map.regCompassChange(function (angel) {
		$('.compass').css({
			'transform': 'rotate(' + (angel - MapConfig.AzimuthalAngle) + 'deg)'
		})
	})
}


function doNextThing() {
	if (object.mac || object.ip) {
		object.isShop = false;
		if (!GetQueryString('shopID') || object.pathfinding) {
			setTimeout(function () {
				console.log("doNextThing");
				$('.waiting').html('正在定位中，请稍等...').css({
					"display": 'none'
				});
			}, 2000);
			getWifi();
		} else {
			if (object.pathfinding) {
				return
			} else {
				$('.waiting').html('地图加载完成').css({
					"display": 'block'
				})
				setTimeout(function () {
					$('.waiting').css({
						"display": 'block'
					}).fadeOut(2000)
				}, 2000);
			}
		}
	} else {
		if (object.pathfinding) {
			return
		} else {
			$('.waiting').css({
				"display": 'block'
			}).html('地图加载完成')
			setTimeout(function () {
				$('.waiting').fadeOut(2000)
			}, 2000);
		}

	}
}


/**
 * @description 寻路事件
 *
 * @param {*} params
 */
function searchPath(params) {

	setTimeout(() => {
		self.map.startPID = urlStart;
	}, 100);


	setTimeout(() => {
		self.map.endPID = urlEnd;
	}, 900);


	setTimeout(() => {
		self.map.searchPath(function (params) {
			if (params.type == 'done') {

				// 二维码导航之后给寻路路线距离
				object.distance = params.dis;

				$('.gSearch').hide()
				self.map.areaClickEmbed = false;

				// 二维码导航之后给导航栏相关信息
				$('#startPoint').val(`${startFloor} ${object.pointNames[urlStart]}`);
				$('#endPoint').val(`${endFloor} ${object.pointNames[urlEnd]}`);

				$('.operation,.setPoint1').show();
				$('.tishi').html('点击开始导航');
				$('.go,.mogo').css('background-color', 'rgb(166, 147, 124)');
				$('.go,.mogo').removeAttr("disabled");
				$('.compass').css('top', '2.48rem');
				$(".floorToggleMinUl,.scale").css('bottom', '3rem');





				$(".swiper-wrapper1 li button").each(function (i) {
					var arr = {}
					arr.floorsId = $(this).attr("data")
					arr.floorsNo = $(this).attr("value")
					floorsData.push(arr)
				})
				var li = ''
				var floorIDsRe = params.floorIDs.reverse()
				// console.log(floorIDsRe);
				for (let i = 0; i < floorIDsRe.length; i++) {
					for (let j = 0; j < floorsData.length; j++) {
						if (floorIDsRe[i] == floorsData[j].floorsId) {
							li = li + '<li  class="floorToggleUl_List" id="floorToggleUl_List">' +
								'<i class="floorToggleMinUl_i"></i><button name="btn" data="' + floorsData[j].floorsId + '" value="' + floorsData[j].floorsNo + '" id ="' + floorsData[j].floorsNo + '" >' + floorsData[j].floorsNo + '</button>' +
								'</li>'
						}
					}
				}
				$(".floorToggle,.changeFBox").hide()
				$(".floorToggleMinUl").append(li)
				$(".floorToggleMinUl li").eq(-1).show().removeClass().addClass('floorToggleUl_List-active')
				$(".floorToggleMinUl li").eq(-1).attr('data', 'isMark')
				if (floorIDsRe.length == 1) {} else {
					for (let j = 0; j < floorIDsRe.length; j++) {
						$(".floorToggleMinUl li").eq(j + 1).find('i').show()
					}
					$(".floorToggleMinUl li").eq(-1).find('i').show().removeClass().addClass("floorToggleMinUl_iR")
				}
				self.map.setAzimuthalAngle(30)
				self.map.setPolarAngle(0)
				$('.looking').hide().show().find('span').html('正在查看 ' + startFloor + '');
				floorJudgment()
				setTimeout(() => {
					self.map.showFloors([object.orderFloors[startFloor]], true)
				}, 500)

			} else {

			}

		});
	}, 1000);

}



//地图初始化后进行操作
function initCompelte(areaData) {



	var $floorData = areaData.map(function (item) {
		return {
			floorID: item.FloorID,
			name: item.Name,
			order: item.Order
		}
	});

	config.floorNumber = $floorData.length;
	object.floorData = $floorData;
	object.floorData = object.floorData.sort(function (a, b) {
		return a.order - b.order;
	});

	object.floorData.forEach(function (t) {
		object.flooridFloors[t.floorID] = t.name;
		object.orderFloors[t.name] = t.floorID;
		object.flooridOrder[t.floorID] = t.order;
		object.floorOrder[t.name] = t.order;
		object.floorNameId[t.name] = t.floorID;
	});

	areaData.forEach(function (t) {
		object.shopList = object.shopList.concat(t.Area)
		t.Area.forEach(data => {
			object.pointNames[data.PI] = data.AN
		})
	});




	object.shopList = object.shopList.filter(function (item) {
		return item.AN;
	});


	// 初始化楼层显示
	$(".floorToggle").html(object.flooridFloors[MapConfig.initFloorID]);
	$('.looking').hide().show().find('span').html('正在查看 ' + object.flooridFloors[MapConfig.initFloorID] + '');

	setTimeout(function () {
		$('.waiting').fadeOut();
	}, 3000);
	bindFloor(object.floorData);
	if (object.mark) {
		setTimeout(function () {
			self.map.selectByID(object.mark, true); //selectUint3DByAreaId(object.mark);
		}, 500);
		object.order = config.floorNumber - Number(object.flooridOrder[GetQueryString('floorid')])
		object.shopID = null;
		object.isSwiper = true;
		mySwiper.destroy(true);
		mySwiper = myswiper();
		mySwiper.init();
		if (self.map.pathDownloaded == true) {
			$('#loadings').css('display', 'none');
		} else {
			self.map.regPathDownloaded(function () {
				$('#loadings').css('display', 'none');
			})
		}
	}
	if (object.endMark) {
		object.xlId.endId = object.endP = self.map.setEndArea(object.endMark, true);
		object.moFloorid.start = object.floorid;
		$('#endPoint').val(`${object.flooridFloors[object.floorid]} ${object.pointNames[object.endMark]}`);
		$('.compass').css({
			'top': '2.48rem'
		})
		$('.operation').show()
		$('.gSearch').hide()
	}
	if (object.shopID) {
		if (object.shopID.match(/,|，|ï¼/)) {
			var ary = [];
			if (object.shopID.indexOf(',') != -1) { //英文逗号
				ary = object.shopID.split(',');
			}
			if (object.shopID.indexOf('，') != -1) { //中文逗号
				ary = object.shopID.split('，');
			}
			if (object.shopID.indexOf('ï¼') != -1) { //中文逗号
				ary = object.shopID.split('ï¼');
			}
			ary = ary.map(function (item) { //去空格
				return item.replace(/\s+/g, "");
			})
			setChangeShopVisible(true, ary);
		} else {
			self.map.focusToShopByNo(object.shopID, 5, 15);
		}
		setTimeout(function () {
			$('.waiting').fadeOut(4000);
		}, 3000);
		object.shopID = null;
		object.isSwiper = true;
		if (self.map.pathDownloaded == true) {
			$('#loadings').css('display', 'none');
			$('.waiting').css({
				"display": 'block'
			}).stop(false, true).html('地图加载完成');
		} else {
			self.map.regPathDownloaded(function () {
				$('#loadings').css('display', 'none');
				$('.waiting').css({
					"display": 'block'
				}).stop(false, true).html('地图加载完成');
			})
		}
	} else if (object.pathfinding) {
		isPathFinding = true;
		$('.waiting').css({
			"display": 'block'
		}).stop(false, true).html('路径规划中,请稍后...');
		if (!self.map.pathDownloaded) {
			self.map.regPathDownloaded(function () {
				initPathfinding();
			});
		} else {
			initPathfinding();
		}

		object.isSwiper = true;
	} else {
		$('#loadings').css('display', 'none');
		$('.waiting').css({
			"display": 'block'
		}).stop(false, true).html('地图加载完成');
		showMark()
		object.isSwiper = true;
	}

	createWXConfig(postData);
	if (object.mac) {
		document.addEventListener("visibilitychange", handleVisibilityChange, false);
	}
	FloorDetection()
	if (qrCode) {
		if (self.map.pathDownloaded) {
			searchPath();
		} else {
			self.map.regPathDownloaded(() => {
				searchPath();
			})
		}
	}

	self.map.move2Point(MapConfig.movePosition);
	self.map.zoomLevel(MapConfig.zoomlevel);

	// 切换楼层模块列表按钮点击事件 floorToggle
	$("#floorToggleUl_List button").on("click", function () {
		self.map.move2Point(MapConfig.movePosition);
		textO = $(this).attr('value')
		dataO = $(this).attr('data')
		nowFloorToggleNo = $(this).attr("id")

		$(".floorToggleUlBox").slideUp("fast")

		$(this).parent().removeClass().addClass('floorToggleUl_List-active');
		$(this).parent().siblings().removeClass().addClass('floorToggleUl_List')
		$(this).parent().find("i").removeClass().addClass('floorToggleMinUl_iR');
		$(this).parent().siblings().find("i").removeClass().addClass('floorToggleMinUl_i')
		self.map.showFloors([dataO], true);
		self.map.regShowLoading(function (ccc) {
			if (ccc == true) {
				$('.loadings').show()
			}
			if (ccc == false) {
				$('.loadings').hide()
			}
		});
		if (isPathGo == false) {
			$(".floorToggle").slideDown("fast").html("" + textO + "")
		}
		object.locationCenter = false
		FloorDetection()
		$(".setPoint").hide()
		if ($('.setPoint1').css('display') == 'none') {
			$('.floorToggle,.floorToggleMinUl,.scale').css('bottom', '.6rem');
			$(".floorToggleUlBox").css('bottom', '.4rem')
		}
		object.floorid = [dataO]
		if (isMogo) {
			$(".looking").hide()
		} else {
			$('.looking').hide().show().find('span').html('正在查看 ' + object.flooridFloors[dataO] + '');
		}

		self.map.zoomLevel(20);
		self.map.setPolarAngle(60);
		if (isFloorToggleCounter == true && fFloor == lFloor) {
			floorCounter = floorCounter + 1
		}
	})
}


function initPathfinding() {
	object.startP = self.map.startNode.pointID = object.pathfinding.sId;
	object.endP = self.map.endNode.pointID = object.pathfinding.eId;
	object.order = object.floorData.length - object.flooridOrder[object.pathfinding.sFid]
	object.moFloorid.start = object.pathfinding.sFid
	mySwiper.destroy(true);
	mySwiper = myswiper();
	mySwiper.init();
	if (self.map.pathDownloaded == true) {
		$('#loadings').css('display', 'none');
	} else {
		self.map.regPathDownloaded(function () {
			$('#loadings').css('display', 'none');
		})
	}
	self.map.regNavigationPause(function () { //暂停模拟导航的时候触发
		$(".floorToggleMinUl li button").removeAttr("disabled");
		// console.log("asd")
		$(".mo_center").html("继续导航")
		$('.floorToggle').show()
		object.isPause = true;
		isFloorToggleCounter = true;
	})
	self.map.searchPath(function (msg) {
		if (msg.type == 'done') {
			$('.setPoint1').stop(false, true).show()
			$('.floorToggle,.floorToggleMinUl,.scale').css('bottom', '3rem');
			$(".floorToggleUlBox").css('bottom', '2.8rem')
			if (object.startP == '' || object.startP == null) {
				$('.tishi').html('请设置起点');
				$('.go,.mogo').attr("disabled", 'disabled').css('backgroundColor', '#999');
			} else {
				$('.tishi').html('点击开始导航');
				$('.mogo').attr("disabled", false).css('backgroundColor', '#a6937c');
			}
			self.map.zoomLevel(18);
			self.map.setPolarAngle(60);
			$('.waiting').stop(false, true).css({
				"display": 'block'
			}).html('路径规划成功');
			object.ispoint = true;
			setTimeout(() => {
				$(".operation").show()
				$('.gSearch').hide()
				$('.compass').css({
					'top': '2.48rem'
				})
				self.map.addMarkToPoint(object.pathfinding.sId, 'start')
				self.map.addMarkToPoint(object.pathfinding.eId, 'end')
			}, 0)
		} else {
			$('#loadings').css('display', 'none');
			alert('寻路失败');
			return;
		}
		setTimeout(function () {
			$('.waiting').fadeOut(4000);
		}, 3000);
		$('#startPoint').val('我的位置');
		object.shopList.forEach((t) => {
			if (t.PI == object.pathfinding.eId) {
				$('#endPoint').val(object.flooridFloors[object.pathfinding.eFid] + '  ' + (t.BN ? t.BN : t.AN))
			}
		})
		setTimeout(function () {
			self.map.showFloors([object.pathfinding.sFid]);
			setTimeout(function () {
				$('#loadings').css('display', 'none');
			}, 500);
		}, 1000);
	})
	object.moFloorid.end = object.pathfinding.eFid;

	pathGo()

}


function setChangeShopVisible(bVisible, data) {
	if (bVisible) {
		var ary = [];
		var doHtml = '<div class="chooseShopBg"><div class="textShop">请选择您要前往的商铺</div><div class="imgShop" onclick ="setChangeShopVisible()" >×</div><div class="chooseShops">';
		for (var i = 0; i < object.shopList.length; i++) {
			for (var j = 0; j < data.length; j++) {
				if (object.shopList[i].AN && object.shopList[i].AN == data[j]) {
					ary.push(object.shopList[i]);
				}
			}
		}
		for (var i = 0; i < ary.length; i++) {
			doHtml += '<div class="shops" data-shopid="' + ary[i].AN + '" onclick="chooseShop(this)" ><span class="floor">' + ary[i].BN + '</span></div>';
		}
		doHtml += '</div></div>';
		$('body').append($(doHtml));
	} else {
		$('.chooseShopBg').remove();
	}
}

function chooseShop(e) {
	self.map.focusToShopByNo($(e).attr('data-shopid'), 5, 15);
	$('.chooseShopBg').remove();
}

//创建楼层
function bindFloor($floorData) {
	var ul = $(".swiper-wrapper1"),
		floorToggleUl = $('.floorToggleUl'),
		floorToggleHtml = '',
		liHtml = '',
		floorDataToggle = $floorData;

	ul.find("li").remove();

	for (var i = $floorData.length - 1, len = $floorData.length; i >= 0; i--) {
		liHtml = liHtml + `<li name=${$floorData[i].floorID} class="swiper-slide swiper-slide1"><button type="button" data="${$floorData[i].floorID}" value="${$floorData[i].name}" class="btn btn-default">${$floorData[i].name}</button></li>`;
		if (GetQueryString('pathfinding') && JSON.parse(GetQueryString('pathfinding')).startFloorid == $floorData[i].floorID && object.isInitOrder) {
			object.order = $floorData.length - $floorData[i].order;
		}
	};

	for (j = 0; j < floorDataToggle.length; j++) {
		floorToggleHtml = floorToggleHtml + `<li class="floorToggleUl_List" id="floorToggleUl_List">
		<i class="floorToggleMinUl_i"></i>
		<button name="btn" data=${$floorData[j].floorID} value="${$floorData[j].name}" id="${$floorData[j].name}">${$floorData[j].name}</button>
		</li>`;
	}
	ul.append(liHtml);
	floorToggleUl.append(floorToggleHtml);
	mySwiper = myswiper()
	mySwiper.init()
};
//点击地图设置起始点和终点
function onSelected(data) {
	console.log(data)
	object.flag = true;
	object.mark = data.nodeId;
	self.map.setPolarAngle(30);
	object.flagClearInterval = false;
	object.locationCenter = false
	$('#text').val(data.shopName ? data.shopName : data.name)
	$('#searchSpan').addClass('go_back')
	self.map.regNavigationPause(function () { //暂停模拟导航的时候触发
		$(".floorToggleMinUl li button").removeAttr("disabled");
		// console.log("asd")
		$(".mo_center").html("继续导航")
		$('.floorToggle').show()
		object.isPause = true;
		isFloorToggleCounter = true;
	})
	$('.setPoint1,.shares').hide();
	$('.setPoint').show();
	$('.mo_daohang,.mo_tishi').slideUp('slow')
	$('.looking').css('display', 'block').find('span').html('正在查看 ' + object.flooridFloors[data.floorID] + '');
	$('.floorToggle').html('' + object.flooridFloors[data.floorID] + '')
	$('.pointName').html(data.shopName ? data.shopName : data.name);
	// $('.pointFloor').html(object.flooridFloors[data.floorID]);
	$('.pointFloor').html(data.name);
	$('.floorToggle,.floorToggleMinUl,.scale').css('bottom', '3rem');
	$(".floorToggleUlBox").css('bottom', '2.8rem')
	FloorDetection()
	object.ispoint = false;
	setStart = function () {
		shopShowLocation = false;
		$('.operation,.setPoint1').css('display', 'block');
		$('.compass').css({
			'top': '2.48rem'
		})
		$('#startPoint').val(object.flooridFloors[data.floorID] + '  ' + (data.shopName ? data.shopName : data.name));
		object.xlId.startId = data.nodeId; //areaID;
		object.moFloorid.start = data.floorID;
		object.moFloorid.startArea = data.shopName ? data.shopName : data.name;
		object.startP = self.map.setStartArea(data.nodeId, true); //areaID, true);
		object.startPP = object.flooridFloors[data.floorID]
		// object.ispoint = false;
		$('.setPoint').css('display', 'none');
		if (object.endP == '' || object.endP == null) {
			$('.tishi').html('请设置终点');
			$('.go,.mogo').attr("disabled", 'disabled').css('backgroundColor', '#999');
		} else {
			if (object.startP == object.endP) {
				alert('起始点和终点相同')
				$('.go,.mogo').attr("disabled", 'disabled').css('backgroundColor', '#999');
			} else {
				$('.tishi').html('点击开始导航');
				$('.go,.mogo').removeAttr("disabled").css('backgroundColor', '#a6937c');


				pathGo();

			}

		}
		$('.operation').css('display') == 'block' ? $('.gSearch').hide() : $('.gSearch').show()

	}
	setEnd = function () {
		object.xlId.endId = data.nodeId; //areaID;
		object.moFloorid.end = data.floorID;
		object.moFloorid.endArea = data.shopName ? data.shopName : data.name;
		$('.compass').css({
			'top': '2.48rem'
		})
		$('#endPoint').val(object.flooridFloors[data.floorID] + '  ' + (data.shopName ? data.shopName : data.name));
		$('.setPoint').hide();
		$('.tishi').html('点击开始导航');
		$('.go').attr("disabled", false).css('backgroundColor', '#69d5c5');
		$(".operation,.setPoint1").show()
		object.endP = self.map.setEndArea(data.nodeId, true); //areaID, true);
		if (object.startP == '' || object.startP == null) {
			$('.tishi').html('请设置起点');
			$('.go,.mogo').attr("disabled", 'disabled').css('backgroundColor', '#999');
		} else {
			if (object.startP == object.endP) {
				alert('起始点和终点相同')
				$('.go,.mogo').attr("disabled", 'disabled').css('backgroundColor', '#999');
			} else {
				$('.tishi').html('点击开始导航');
				$('.go,.mogo').attr("disabled", false).css('backgroundColor', '#a6937c');
				pathGo();

			}
		}
		$('.operation').css('display') == 'block' ? $('.gSearch').hide() : $('.gSearch').show();
	}
};



document.addEventListener('touchmove', function () {
	object.flagClearInterval = false;
}, false)

//寻路
function go() {
	if (qrCode) {
		self.map.reset();
		object.locationCenter = true;
		object.ispathGoer = true;
		$('#loadings').show().children('.load_xun').show()
			.siblings().hide()
		$(".mo_tishi").slideDown()
		$('.setPoint,.setPoint1').hide();
		self.map.searchPath(function (msg) {
			if (msg.type == 'done') {
				$('.floorToggleMinUl,.scale').css('bottom', '1.6rem');
				self.map.zoomLevel(3);
				if (object.moFloorid.start == object.moFloorid.end) {
					self.map.setPolarAngle(0);
				} else {
					self.map.setPolarAngle(0);
					self.map.setAzimuthalAngle(50);
					$('.looking').hide()
				}
				if (object.locationCenter) {
					self.map.showLocation()
				}
				$('#loadings').hide()
				object.ispoint = true;
			} else {
				$('#loadings').hide()
				alert('寻路失败');
				return;
			}
			// $('.waiting').hide()
		})
	} else {
		self.map.reset();
		object.locationCenter = true;
		object.ispathGoer = true;
		if ($('.go').attr("disabled") != 'disabled' && (object.startP || '') && (object.endP || '')) {
			if (object.startP == object.endP) {
				alert('起始点相同,请重新设置');
				return;
			}
			$('#loadings').show().children('.load_xun').show()
				.siblings().hide()
			$(".mo_tishi").slideDown()
			$('.setPoint,.setPoint1').hide();
			self.map.searchPath(function (msg) {
				if (msg.type == 'done') {
					$('.floorToggleMinUl,.scale').css('bottom', '1.6rem');
					self.map.zoomLevel(3);
					if (object.moFloorid.start == object.moFloorid.end) {
						self.map.setPolarAngle(0);
					} else {
						self.map.setPolarAngle(0);
						self.map.setAzimuthalAngle(50);
						$('.looking').hide()
					}
					if (object.locationCenter) {
						self.map.showLocation()
					}
					$('#loadings').hide()
					object.ispoint = true;
				} else {
					$('#loadings').hide()
					alert('寻路失败');
					return;
				}
				// $('.waiting').hide()
			})
		} else {
			return;
		}
	}

}
//返回 
function goback() {
	$('.operation, .setPoint1, .setPoint, #loadings, .mo_tishi').hide();
	object.startP = object.endP = null;
	$('#endPoint,#startPoint').val('');
	$('.gSearch').css('display', 'block');
	$('.compass').css({
		'top': '1.1rem'
	})
	$('.floorToggle,.floorToggleMinUl,.scale').css('bottom', '.6rem');
	$(".floorToggleUlBox").css('bottom', '.4rem')
	if (qrCode) {
		self.map.showFloors([object.floorNameId[startFloor]], true);
		object.order = object.floorData.length - object.flooridOrder[object.floorNameId[startFloor]]
		$('.floorToggle').html(startFloor)
	} else {
		self.map.showFloors([object.moFloorid.start]);
		object.order = object.floorData.length - object.flooridOrder[object.moFloorid.start]
	}

	mySwiper.destroy(true);
	mySwiper = myswiper();
	mySwiper.init();
	isPathFinding = false;
	isMogo = false;
	object.flagClearInterval = false;
	self.map.areaClickEmbed = true;
	self.map.reset();
	self.map.setAzimuthalAngle(60);
	self.map.zoomLevel(15);
	self.map.move2Point(MapConfig.movePosition);
	self.map.setPolarAngle(60);
	self.map.clearPath(true);
	self.map.cleanSelectUnit3D();
	$('#searchSpan').removeClass('go_back')
	goBackInside()
	FloorDetection()

}

function share(number) {
	if (number == 1) {
		$('.setPoint').slideUp('slow');
		$('.shares').slideDown('slow')
	} else {
		$('.setPoint').slideDown('slow');
		$('.shares').slideUp('slow')
	}

}

// 分享
function noShow() {
	$('.shares').hide()
	$('.share_shade').hide()
	$('.setPoint').show();
}

// 放大地图
function biger() {
	self.map.cameraRadius = self.map.cameraRadius - 1000
}

// 缩小地图
function smaller() {
	self.map.cameraRadius = self.map.cameraRadius + 1000
}

// 定位功能
function showMark() {
	object.locationCenter = true;
	object.ispathGoer = true;
	$('.waiting').stop(false, true).css({
		'display': 'none'
	}).html('正在定位中，请稍等...')
	object.flags = true;
	object.isInitOrder = false;
	object.ispoint = true;
	object.flagClearInterval = true;
	isShowLocateTip = true;
	shopShowLocation = true;
	// getLocations()
	if (isPathFinding) {
		if (object.mac || object.ip || debug) {
			getWifi(); // 如果多次点击出现叠加问题 
		} else {
			setTimeout(function () {
				$('.waiting').stop(false, true).css({
					"display": 'none'
				}).html('WIFI未打开、当前信号弱或不在信号覆盖的区域无法定位，请重连当前WIFI').fadeOut(6000)
				// $('.waiting img').attr('src', './images/5.wifi2.png')
			}, 3000)
		}
	} else {
		if (object.mac || object.ip || debug) {
			getWifi(); // 如果多次点击出现叠加问题 
		} else {
			setTimeout(function () {
				$('.waiting').stop(false, true).css({
					"display": 'none'
				}).html('WIFI未打开、当前信号弱或不在信号覆盖区域无法定位，请重连当前WIFI').fadeOut(4000)
				// $('.waiting img').attr('src', './images/5.wifi2.png')
			}, 3000)
		}
	}
}


// 3d切换
function mapToggle() {
	var value = $('.map_three').text()
	if (value == '3D') {
		self.map.setPolarAngle(60)
		$('.map_three').text('2D')
	} else {
		self.map.setPolarAngle(0)
		$('.map_three').text('3D')
	}

}


// 语音处理
function audioAutoPlay(id, otext, ospd) {
	var audio = document.getElementById(id)
	if (object.audioEnd) {
		object.audioEnd = false
		$.get("https://service.chaunve.com/TTSWebService.asmx/BaiduTTS?", {
				"text": otext,
				"spd": ospd,
			},
			function (data) {
				$(".mo_yuyin").attr("src", data);
			})
		play = function () {
			audio.play();
			document.removeEventListener("touchstart", play, false);
		};
		audio.play();
		document.addEventListener("WeixinJSBridgeReady", function () {
			play();
		}, false);
		document.addEventListener('YixinJSBridgeReady', function () {
			play();
		}, false);
		$(".mo_yuyin").attr("src", "");
	}
	if (audio.ended) {
		object.audioEnd = true;
	}
}


/* 模拟导航 */
function mogo() {

	if (qrCode) {
		$('.floorToggleMinUl,.scale').css('bottom', '1.6rem');
		self.map.zoomLevel(3);
		var i = 1;
		object.timers = setInterval(function () {
			i = i + 1;
		}, 1000)
		self.map.simulate();
		self.map.showFloors([object.floorNameId[startFloor]]);
		audioAutoPlay("mo_yuyin", "开始导航", "5")
		$('.operation,.setPoint1').slideUp('fast');
		$('.mo_daohang,.mo_tishi').slideDown('fast');
		$('.looking,.changeF,.gSearch,.floorToggle').hide();
		$(".compass").css('top', '2.48rem')
		$('.mo_text').html('请沿当前路线行走');
		$('#endPoint').val()
		// $('.mo_footerS').html('起点位置 : ' + $('#startPoint').val() + '')
		$('.mo_footerE').html('目标位置 : ' + $('#endPoint').val() + '')
		$('.mo_end_q').html('起点 : ' + $('#startPoint').val() + '')
		$('.mo_end_z').html('目标 : ' + $('#endPoint').val() + '')
		self.map.regNavigationWalk(function (walkDetail) {
			isMogo = true
			nowFloorId = walkDetail.floorID;
			// self.map.areaClickEmbed = false;
			// console.log(nowFloorId)
			$(".floorToggleMinUl li button").attr("disabled", true)
			self.map.setPolarAngle(0);
			if (!walkDetail.nextFloorName) {
				if (walkDetail.turn == 'Right') {
					$('.mo_text').html(+Math.ceil(walkDetail.dis / 50) + '米后 右转')
					if (Math.ceil(walkDetail.dis / 50) > 0) {
						$('.mo_pic').css({
							'background': 'url(./images/youzhuan.png) center center no-repeat',
							'backgroundSize': 'contain'
						})
					}
					if (walkDetail.dis < 200) {
						$('.mo_text').html('右转')
						if (object.flagAudio) {
							audioAutoPlay("mo_yuyin", "前方右转", "5")
						}

					}
				} else if (walkDetail.turn == 'Left') {
					$('.mo_text').html(+Math.ceil(walkDetail.dis / 50) + '米后 左转')
					if (Math.ceil(walkDetail.dis / 50) > 0) {
						$('.mo_pic').css({
							'background': 'url("./images/zuozhuan.png") center center no-repeat',
							'backgroundSize': 'contain'
						})
					}
					if (walkDetail.dis < 200) {
						$('.mo_text').html('左转')
						if (object.flagAudio) {
							audioAutoPlay("mo_yuyin", "前方左转", "5")
						}

					}
				} else if (walkDetail.turn == 'LeftFront') {
					$('.mo_text').html(+Math.ceil(walkDetail.dis / 50) + '米后 左前方前进')
					if (Math.ceil(walkDetail.dis / 50) > 0) {
						$('.mo_pic').css({
							'background': 'url("./images/zuoqian.png") center center no-repeat',
							'backgroundSize': 'contain'
						})

					}
					if (walkDetail.dis < 200) {
						$('.mo_text').html('左前方前进')
						if (object.flagAudio) {
							audioAutoPlay("mo_yuyin", "左前方前进", "5")
						}
					}
				} else if (walkDetail.turn == 'RightFront') {
					$('.mo_text').html(+Math.ceil(walkDetail.dis / 50) + '米后 右前方前进')
					if (Math.ceil(walkDetail.dis / 50) > 0) {
						$('.mo_pic').css({
							'background': 'url("./images/youqian.png") center center no-repeat',
							'backgroundSize': 'contain'
						})

					}
					if (walkDetail.dis < 200) {
						$('.mo_text').html('右前方前进')
						if (object.flagAudio) {
							audioAutoPlay("mo_yuyin", "右前方前进", "5")
						}

					}
				} else if ((walkDetail.turn == 'Lifts' && walkDetail.dis == 0) || (walkDetail.turn == 'Escalator' && walkDetail.dis == 0)) {
					$(".floorToggleUl_List-active").prev().removeClass().addClass("floorToggleUl_List-active").siblings().removeClass().addClass("floorToggleUl_List")
					$(".floorToggleUl_List-active").find("i").removeClass().addClass("floorToggleMinUl_iR").parent().siblings().find("i").removeClass().addClass("floorToggleMinUl_i")
				} else {
					$('.mo_text').html(+Math.ceil(walkDetail.dis / 50) + '米后 到达终点')
					object.audioEnd = true;
					$('.mo_pic').css({
						'background': 'url("./images/zhixing.png") center center no-repeat',
						'backgroundSize': 'contain'
					})
					if (walkDetail.dis == 0 && (walkDetail.turn == 'end' || walkDetail.turn == 'carport')) {
						if (object.flagAudio) {
							audioAutoPlay("mo_yuyin", "已到达目的地附近，感谢使用地图寻路系统", "5")
						}
						clearInterval(object.timers)
						isMogo = false;
						isFloorToggleCounter = false;
						floorCounter = 0;
						$(".mo_end_time").html(i)
						$('.mo_distance').html(Math.ceil(object.distance / 50))
						setTimeout(() => {
							$('.mo_daohang,.mo_tishi').slideUp('fast');
							$('.operation,.setPoint1').css('display', 'none')
							$(".mo_end").fadeIn(500);
							$(".compass").css("top", "1.1rem")
						}, 1000);

					}
				}
			} else {
				let value
				if (walkDetail.pass == 'Lifts') {
					value = '乘电梯到达' + walkDetail.nextFloorName + '楼'
				} else {
					value = '乘手扶梯到达' + walkDetail.nextFloorName + '楼'
				}
				$('.mo_text').html(value)
				if (object.flagAudio) {
					audioAutoPlay("mo_yuyin", value, "5")
				}
			}
		});
	} else {
		$('.floorToggleMinUl,.scale').css('bottom', '1.6rem');
		// self.map.showFloors(fFloorid ? fFloorid : [object.pathfinding.sFid])
		self.map.zoomLevel(3);
		var i = 1;
		object.timers = setInterval(function () {
			i = i + 1;
		}, 1000)
		self.map.simulate();
		self.map.showFloors([object.moFloorid.start])
		audioAutoPlay("mo_yuyin", "开始导航", "5")
		$('.operation,.setPoint1').slideUp('fast');
		$('.mo_daohang,.mo_tishi').slideDown('fast');
		$('.looking,.changeF,.gSearch,.floorToggle').hide();
		$(".compass").css('top', '2.48rem')
		$('.mo_text').html('请沿当前路线行走');
		$('#endPoint').val()
		// $('.mo_footerS').html('起点位置 : ' + $('#startPoint').val() + '')
		$('.mo_footerE').html('目标位置 : ' + $('#endPoint').val() + '')
		$('.mo_end_q').html('起点 : ' + $('#startPoint').val() + '')
		$('.mo_end_z').html('目标 : ' + $('#endPoint').val() + '')
		self.map.regNavigationWalk(function (walkDetail) {
			isMogo = true
			nowFloorId = walkDetail.floorID;
			// self.map.areaClickEmbed = false;
			// console.log(nowFloorId)
			$(".floorToggleMinUl li button").attr("disabled", true)
			self.map.setPolarAngle(0);
			if (!walkDetail.nextFloorName) {
				if (walkDetail.turn == 'Right') {
					$('.mo_text').html(+Math.ceil(walkDetail.dis / 50) + '米后 右转')
					if (Math.ceil(walkDetail.dis / 50) > 0) {
						$('.mo_pic').css({
							'background': 'url(./images/youzhuan.png) center center no-repeat',
							'backgroundSize': 'contain'
						})
					}
					if (walkDetail.dis < 200) {
						$('.mo_text').html('右转')
						if (object.flagAudio) {
							audioAutoPlay("mo_yuyin", "前方右转", "5")
						}

					}
				} else if (walkDetail.turn == 'Left') {
					$('.mo_text').html(+Math.ceil(walkDetail.dis / 50) + '米后 左转')
					if (Math.ceil(walkDetail.dis / 50) > 0) {
						$('.mo_pic').css({
							'background': 'url("./images/zuozhuan.png") center center no-repeat',
							'backgroundSize': 'contain'
						})
					}
					if (walkDetail.dis < 200) {
						$('.mo_text').html('左转')
						if (object.flagAudio) {
							audioAutoPlay("mo_yuyin", "前方左转", "5")
						}

					}
				} else if (walkDetail.turn == 'LeftFront') {
					$('.mo_text').html(+Math.ceil(walkDetail.dis / 50) + '米后 左前方前进')
					if (Math.ceil(walkDetail.dis / 50) > 0) {
						$('.mo_pic').css({
							'background': 'url("./images/zuoqian.png") center center no-repeat',
							'backgroundSize': 'contain'
						})

					}
					if (walkDetail.dis < 200) {
						$('.mo_text').html('左前方前进')
						if (object.flagAudio) {
							audioAutoPlay("mo_yuyin", "左前方前进", "5")
						}
					}
				} else if (walkDetail.turn == 'RightFront') {
					$('.mo_text').html(+Math.ceil(walkDetail.dis / 50) + '米后 右前方前进')
					if (Math.ceil(walkDetail.dis / 50) > 0) {
						$('.mo_pic').css({
							'background': 'url("./images/youqian.png") center center no-repeat',
							'backgroundSize': 'contain'
						})

					}
					if (walkDetail.dis < 200) {
						$('.mo_text').html('右前方前进')
						if (object.flagAudio) {
							audioAutoPlay("mo_yuyin", "右前方前进", "5")
						}

					}
				} else if ((walkDetail.turn == 'Lifts' && walkDetail.dis == 0) || (walkDetail.turn == 'Escalator' && walkDetail.dis == 0)) {
					$(".floorToggleUl_List-active").prev().removeClass().addClass("floorToggleUl_List-active").siblings().removeClass().addClass("floorToggleUl_List")
					$(".floorToggleUl_List-active").find("i").removeClass().addClass("floorToggleMinUl_iR").parent().siblings().find("i").removeClass().addClass("floorToggleMinUl_i")
				} else {
					$('.mo_text').html(+Math.ceil(walkDetail.dis / 50) + '米后 到达终点')
					object.audioEnd = true;
					$('.mo_pic').css({
						'background': 'url("./images/zhixing.png") center center no-repeat',
						'backgroundSize': 'contain'
					})
					if (walkDetail.dis == 0 && (walkDetail.turn == 'end' || walkDetail.turn == 'carport')) {
						if (object.flagAudio) {
							audioAutoPlay("mo_yuyin", "已到达目的地附近，感谢使用地图寻路系统", "5")
						}
						clearInterval(object.timers)
						isMogo = false;
						isFloorToggleCounter = false;
						floorCounter = 0;
						$(".mo_end_time").html(i)
						$('.mo_distance').html(Math.ceil(object.distance / 50))
						setTimeout(() => {
							$('.mo_daohang,.mo_tishi').slideUp('fast');
							$('.operation,.setPoint1').css('display', 'none')
							$(".mo_end").fadeIn(500);
							$(".compass").css("top", "1.1rem")
						}, 1000);

					}
				}
			} else {
				let value
				if (walkDetail.pass == 'Lifts') {
					value = '乘电梯到达' + walkDetail.nextFloorName + '楼'
				} else {
					value = '乘手扶梯到达' + walkDetail.nextFloorName + '楼'
				}
				$('.mo_text').html(value)
				if (object.flagAudio) {
					audioAutoPlay("mo_yuyin", value, "5")
				}
			}
		});
	}



}

/* 继续导航 */
function mo_goOn() {
	if (object.isPause == true) {
		self.map.toggleSimulate(true)
		object.isPause = false;
		goOnInside()
	}
	$('.floorToggle').hide()
	$(".mo_center").html("正在导航")
	isFloorToggleCounter = false;
	floorCounter = 0;
	$(".floorToggleMinUl li button").attr("disabled", true)
	// console.log(nowFloorId)
}

/* 结束页传入反馈标签 */
$(function () {
	$(".taptap").on("click", function () {
		var index = $(this).index();
		$(this).addClass("taptaptap");
		$(this).siblings().removeClass("taptaptap");
		if (index == 0) {
			$(".mo_end_textaabb").val("体验流畅")
		} else if (index == 1) {
			$(".mo_end_textaabb").val("")
			$(".mo_end_textaabb").val("贴心提示")
		} else if (index == 2) {
			$(".mo_end_textaabb").val("")
			$(".mo_end_textaabb").val("定位不准")
		} else if (index == 3) {
			$(".mo_end_textaabb").val("")
			$(".mo_end_textaabb").val("信息有误")
		}
	})
})

/* 结束页关闭 */
function moEndClose() {
	$(".mo_end").css("display", "none")
	object.startP = object.endP = null;
	if (qrCode) {
		self.map.showFloors([object.floorNameId[startFloor]]);
		object.order = object.floorData.length - object.flooridOrder[object.floorNameId[startFloor]]
	} else {
		self.map.showFloors([object.moFloorid.start]);
		object.order = object.floorData.length - object.flooridOrder[object.moFloorid.start]
	}
	mySwiper.destroy(true);
	mySwiper = myswiper();
	mySwiper.init();
	$('#endPoint,#startPoint').val('');
	// $(".message").show();
	$(".gSearch").show();
	$('.floorToggle,.floorToggleMinUl,.scale').css('bottom', '.6rem');
	$(".floorToggleUlBox").css('bottom', '.4rem')
	$(".compass").css("top", "1.1rem")
	$(".scale").show();
	self.map.cleanSelectUnit3D()
	self.map.clearPath(true)
	$('.taptaptap').removeClass('taptaptap')
	$('.starability-basic input').prop('checked', false)
	document.querySelector('.mo_end_textaabb').placeholder = ' 还有想说的'
	self.map.zoomLevel(15);
	self.map.setAzimuthalAngle(60);
	$('#searchSpan').removeClass('go_back');
	self.map.hideLocationMark();
	document.querySelector('#text').placeholder = '输入商户关键字搜索';
	$('#text').val('');
	config.flagMark ? $('.mark').show() : $('mark').hide()
	goback()
	moEndClear()

	$('.navigationCompletedPopUps').show();
	setTimeout(() => {
		$('.navigationCompletedPopUps').fadeOut(1500);
	}, 500);
}

/* 结束页发送并关闭 */
function moEndSend() {
	// self.map.areaClickEmbed = true;
	$(".mo_end").hide()
	$(".thanks_tips").fadeIn()
	setTimeout(() => {
		$(".thanks_tips").fadeOut()
	}, 1200);
	// $(".changeF").css({
	// 	"display": "block",
	// 	"bottom": "0.9375rem"
	// })
	object.startP = object.endP = null;
	if (qrCode) {
		self.map.showFloors([object.floorNameId[startFloor]]);
		object.order = object.floorData.length - object.flooridOrder[object.floorNameId[startFloor]]
	} else {
		self.map.showFloors([object.moFloorid.start]);
		object.order = object.floorData.length - object.flooridOrder[object.moFloorid.start]
	}
	mySwiper.destroy(true)
	mySwiper = myswiper()
	mySwiper.init()
	$('#endPoint,#startPoint').val('');
	// $(".message").show();
	$(".gSearch").show();
	$('.floorToggle,.floorToggleMinUl,.scale').css('bottom', '.6rem');
	$(".floorToggleUlBox").css('bottom', '.4rem')
	$(".compass").css("top", "1.1rem")
	$(".scale").show();
	self.map.cleanSelectUnit3D()
	self.map.clearPath(true)
	$('.taptaptap').removeClass('taptaptap')
	$('.starability-basic input').prop('checked', false)
	document.querySelector('.mo_end_textaabb').placeholder = '还有想说的'
	self.map.zoomLevel(15);
	self.map.setAzimuthalAngle(60);
	$('#searchSpan').removeClass('go_back');
	document.querySelector('#text').placeholder = '输入商户关键字搜索';
	$('#text').val('');
	config.flagMark ? $('.mark').show() : $('mark').hide()
	// self.map.hideLocationMark();
	goback()
	moEndClear()

	$('.navigationCompletedPopUps').show();
	setTimeout(() => {
		$('.navigationCompletedPopUps').fadeOut(1500);
	}, 500);
}


// 关闭模拟导航
function moClose() {

	$('.mo_daohang,.mo_tishi').slideUp('fast');
	$('.looking,.changeF').css({
		'display': 'block'
	});
	// $('#speed').html(' ');
	$(".compass").css('top', '2.48rem')
	$('.setPoint, #loadings').hide();
	$('.changeF,.looking').show();
	$('#searchSpan').removeClass('go_back')
	// self.map.showFloors([object.moFloorid.start])
	if (qrCode) {
		object.order = object.floorData.length - object.flooridOrder[object.floorNameId[startFloor]]
	} else {
		object.order = object.floorData.length - object.flooridOrder[object.moFloorid.start]
	}
	mySwiper.destroy(true)
	mySwiper = myswiper()
	mySwiper.init()
	self.map.clearPath(false);
	// self.map.cleanSelectUnit3D();
	self.map.hideLocationMark();
	$('.floorToggle,.floorToggleMinUl,.scale').css('bottom', '.6rem');
	$(".floorToggleUlBox").css('bottom', '.4rem')
	$('.setPoint1,.operation,.mark').show();
	if ($('.operation').css('display') == 'block') {
		$('.gSearch').hide();
	} else {
		$('.gSearch').show();
	}
	goback()
	moEndClear()
	$('.navigationCompletedPopUps').show();
	setTimeout(() => {
		$('.navigationCompletedPopUps').fadeOut(1500);
	}, 500);
}

// 关闭语音
function volumeOnOff(span) {
	var autoplay_audio = $("#mo_yuyin")[0];
	if (object.isTrue) {
		$(span).css({
			'background': "url('./images/声音x.png') center center no-repeat",
			'backgroundSize': 'contain'
		});
		autoplay_audio.volume = 0
		object.isTrue = !object.isTrue;
	} else {
		$('#speed').html($('.mo_text').text())
		$(span).css({
			'background': "url('./images/声音.png') center center no-repeat",
			'backgroundSize': 'contain'
		});
		autoplay_audio.volume = 1;
		object.isTrue = !object.isTrue;
	}
}

// 语音图片
function yuyin(span) {
	if (object.flagAudio) {
		$(span).css({
			'background': "url('./images/声音x.png') center center no-repeat",
			'backgroundSize': 'contain'
		});
		object.flagAudio = !object.flagAudio;
	} else {
		$(span).css({
			'background': "url('./images/声音.png') center center no-repeat",
			'backgroundSize': 'contain'

		});
		object.flagAudio = !object.flagAudio;
	}
}

//分享
$(".sharedbtn").click(function () {
	$(".sharemask").show();
});
$(".sharemask").click(function () {
	$(".sharemask").hide();
})


var px = 50;

var connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection || {
	type: 'unknown'
};
var type_text = ['unknown', 'ethernet', 'wifi', '2g', '3g', '4g', 'none'];
// console.log(connection.type);
var btn_el = document.getElementById("btn");

function get_status() {
	if (typeof (connection.type) == "number") {
		connection.type_text = type_text[connection.type];
	} else {
		connection.type_text = connection.type;
	}
	if (typeof (connection.bandwidth) == "number") {
		if (connection.bandwidth > 10) {
			connection.type = 'wifi';
		} else if (connection.bandwidth > 2) {
			connection.type = '3g';
		} else
		if (connection.bandwidth > 0) {
			connection.type = '2g';
		} else if (connection.bandwidth == 0) {
			connection.type = 'none';
		} else {
			connection.type = 'unknown';
		}
	}
	// console.log(navigator.onLine)
	if (navigator.onLine == false) {
		$(".helpMsg").html("当前信号弱或不在信号覆盖区域无法定位，请重新连接商场WIFI")
		$(".helpMsg").fadeIn()
	} else {
		$(".helpMsg").html("")
		$(".helpMsg").fadeOut()
	}
}




function handleVisibilityChange() {
	if (document.hidden) {

		console.log("hidden");
	} else {
		getWifi();
		console.log("visible");

	}
}


function convertCoords(params, wifiArea) {
	var p = {};
	p.x = wifiArea.width / wifiArea.tx * params.x + wifiArea.left - GIM.OFFSET;
	p.y = -(wifiArea.height / wifiArea.ty * params.y + wifiArea.top) + GIM.OFFSET;
	return p;

}
// 创建楼层功能函数
function myswiper($floorid) {

	return new Swiper('.swiper-container1', {
		on: {
			slideChangeTransitionEnd: function () {
				// object.floorid = object.orderFloors[this.slides[this.activeIndex].innerText]
				if (!object.shopID) {
					self.map.showFloors([object.floorid])
				}
				if (object.isSwiper) {
					$('.looking').show().find('span').html('正在查看 ' + object.flooridFloors[object.floorid] + '');
				}
				self.map.setAzimuthalAngle(MapConfig.AzimuthalAngle);
				self.map.setPolarAngle(MapConfig.PolarAngle);
				$('.operation, .setPoint1, .setPoint').hide();
				$('.floorToggle,.floorToggleMinUl,.scale').css('bottom', '.6rem');
				$(".floorToggleUlBox").css('bottom', '.4rem')
				$('.gSearch').show()
				object.locationCenter = false

			}
		},
		init: false,
		direction: 'vertical',
		slidesPerView: 'auto',
		initialSlide: object.order,
		// initialSlide: 9,
		slideToClickedSlide: true,
		centeredSlides: true,
		freeMode: true,
		observer: true, //修改swiper自己或子元素时，自动初始化swiper
		observeParents: true,
	});
}


// 搜索页面功能开始
function goSearch() {
	$('.main').css({
		'display': 'block'
	});
	$(".looking").hide()
	document.querySelector('#text').placeholder = ' '
	document.querySelector('#text').value = ''
	$('#searchSpan').addClass('go_back')

}

// 退出搜索
function searchBack() {
	if ($('#text').val() != '') {
		$('#text').val('')
		$('.main').show();
		$('.inputName').hide()
		document.querySelector('#text').focus()
	} else {
		$('.main,.searchBtn,.inputName,.setPoint').hide();
		$('#searchSpan').removeClass('go_back')
		$('.operation').css('display') == 'block' ? $('.gSearch').hide() : $('.gSearch').show()
		if($('.setPoint1').css('display') == 'none'){
			$('.floorToggle,.floorToggleMinUl,.scale').css('bottom', '.6rem');
			$(".floorToggleUlBox").css('bottom', '.4rem')
		}
		if ($('.look_text').html() !== "") {
			$('.looking').show();
		}
		self.map.cleanSelectUnit3D()
	}


	// self.map.areaClickEmbed = true;
}

function spanBtn() {
	$('.spanSearch').on('click', function () {
		var name = $(this).html().toLowerCase()
		document.querySelector('#text').value = name;
		$('#searchSpan').addClass('go_back');
		bindSearch(name)
	})

}

//点击历史记录列表搜索
function hisLiBtn(li) {
	var name = $(li).html().toLowerCase()
	document.querySelector('#text').value = name;
	$('#searchSpan').addClass('go_back');
	$(li).insertBefore($(li).siblings().eq(0))
	bindSearch(name, true)
}


// 历史记录点击按钮
function historyBtn() {
	$('.his_list ul li ').on('click', function () {
		var name = $(this).html().toLowerCase()
		bindSearch(name, true)
	})
}

//清空历史记录
function clearHistory() {
	$('.his_list ul li').remove()
}


$('#text').on('input', function () {
	var searchName = $(this).val().toLowerCase()
	bindSearch(searchName, false)
})


function searchHtml() {
	$('.gSearch,.main').show()
	document.querySelector('#text').focus()
}

function bindSearch(searchName, ls) {
	$('.inputName').show()
	var arrName = []
	var ul = $(".swiper-container3"),
		htmlS = '<ul class="swiper-wrapper swiper-wrapper3">',
		htmlE = '</ul>',
		liHtml = []
	ul.find(".swiper-wrapper3").remove();
	if (object.shopList) {
		object.shopList.forEach((e) => {
			if (e.AN && e.AN.toLowerCase().indexOf(searchName) != -1 && e.AN != 0) {
				arrName.push(e)
			}
		})
		if (arrName.length > 0) {
			arrName.forEach(function (element) {
				var floorName = '';
				for (var i = 0; i < object.floorData.length; i++) {
					if (object.floorData[i].floorID == element.FloorID) {
						floorName = object.floorData[i].name;
						break;
					}
				}
				liHtml.push('<li class="searchPoint clearfix swiper-slide swiper-slide3" onclick=setPoint("' + encodeURI(element.AN) + '","' + element.FloorID + '","' + element.PI + '","' + element.AN + '",' + ls + ')>' +
					'<div class="left">' +
					'<p class="pointName">' + (element.AN) + '</p>' +
					'<p class="pointFloor">楼层：' + floorName + '</p>' +
					'</div>' +
					'</li>')
			})
			if (liHtml.length > 0) {
				ul.html(htmlS + liHtml.join('') + htmlE)
				var mySwipers = new Swiper('.swiper-container3', {
					direction: 'vertical',
					slidesPerView: 'auto',
					initialSlide: 0,
					slideToClickedSlide: true,
					observer: true, //修改swiper自己或子元素时，自动初始化swiper
					observeParents: true,

				})
			}

		} else {
			var h = "<div class='noList'>无搜索结果</div>"
			ul.html(htmlS + h + htmlE)
		}

	}
}


//点击搜索结果列表跳转
function setPoint(shopName, floorID, pointID, $name, ls) {
	var shopName = decodeURI(shopName)
	$('.main,.inputName').hide()
	$('#text').val(shopName)
	object.mark = pointID;
	$('.pointName').html(shopName);
	$('.pointFloor').html(object.flooridFloors[floorID]);
	$('.floorToggle,.floorToggleMinUl,.scale').css('bottom', '3rem');
	$(".floorToggleUlBox").css('bottom', '2.8rem')
	//object.floorid = floorID
	//object.order = object.floorData.length - object.flooridOrder[object.floorid]
	mySwiper.destroy(true);
	mySwiper = myswiper(config.floorNumber);
	mySwiper.init();
	self.map.focusToShopByNo($name, 5, 15);

	//生成历史记录列表
	if (!ls) {
		var h = '<li onclick="hisLiBtn(this)">' + shopName + '</li>'
		$('.his_list ul li').length > 0 ? $('.his_list ul').children('li').eq(0).before(h) : $('.his_list ul').append(h)
	} else {
		return
	}

}
// 总体功能函数

// 截取url参数
function GetQueryString(name) {
	var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
	var r = window.location.search.substr(1).match(reg);
	if (r != null) return unescape(r[2]);
	return null;
}


// 切换楼层模块主按钮点击事件
$(function () {
	$(".floorToggleUlBox").hide()
	$(".swiper-pagination").hide()
	$(".floorToggle").on("click", function () {
		$(".floorToggle").slideUp("fast")
		var list = document.querySelectorAll('.floorToggleUl_List')
		$(".floorToggleUlBox").slideDown("fast")

		$(".swiper-pagination").fadeIn()
		if (isInit == true) {
			/* 控制滚动条 */
			setTimeout(() => {
				$(".floorToggleUl").children("i #floorToggleUl_iT").css("opacity", "1")
			}, 350);
			var scrollHeight = $('.floorToggleUl').prop("scrollHeight");
			$('.floorToggleUl').scrollTop(scrollHeight, 200);
			isInit = false;
		} else {
			setTimeout(() => {
				$(".floorToggleUl").children("i").css("opacity", "1")
			}, 350);
		}
	})
})


function FloorDetection() {
	var outDivValue = $(".floorToggle").html()
	// console.log(outDivValue)
	if (nowFloorNo !== "" && nowFloorNo !== undefined) {
		var outDivValue = nowFloorNo
		$(".floorToggle").html(nowFloorNo)
	}
	var btnL = $(".floorToggleUl li button")
	for (let i = 0; i < btnL.length; i++) {
		if (btnL.length < 11) {
			$(".floorToggleUl").css("height", "auto")
			$(".floorToggleUl .floorToggleUl_i").hide()
			// $(".floorToggleUl .floorToggleUlBottom_i").hide()
		}
		if (outDivValue == btnL.eq(i).html()) {
			// console.log(i)
			btnL.eq(i).parent().removeClass().addClass('floorToggleUl_List-active');
			btnL.eq(i).parent().siblings().removeClass().addClass('floorToggleUl_List')
		}
	}
}


// 根据后台返回的数据  获取当前的楼层
function floorJudgment() {
	$("#floorToggleUl_List button").on("click", function () {
		arrT.push($(this).html().toString())
	})
	$(".floorToggleMinUl").on('click', ' #floorToggleUl_List button', function () {
		$(this).parent().removeClass().addClass('floorToggleUl_List-active');
		$(this).parent().siblings().removeClass().addClass('floorToggleUl_List')
		$(this).parent().find("i").removeClass().addClass('floorToggleMinUl_iR');
		$(this).parent().siblings().find("i").removeClass().addClass('floorToggleMinUl_i')
		self.map.showFloors([object.floorNameId[$(this).text()]], true);
		$('.looking').hide().show().find('span').html('正在查看 ' + $(this).text() + '');
	})
	// console.log(arrT)
}


/* 获取楼层列表index */
function searchKeys(needle, haystack) {
	for (i in haystack) {
		if (haystack[i] == needle) {
			if (i.length = 1) {
				// fIndex = i
				return i
			}
		}
	}
}



// 出路线方法   在设置起点setStart 终点setEnd  起点终点交换reverse等地方调用
function pathGo() {
	$('.floorToggleMinUl').children().remove()
	if ($('.setPoint1').css('display') == 'none') {
		$('.setPoint1').show()
	}
	if (object.startP !== "" && object.endP !== "") {
		// if ($('.go').attr("disabled") != 'disabled' && (object.startP || '') && (object.endP || '')) {

		if (object.startP == object.endP) {
			// console.log("asd")
			$(".searchPathFailMsg").html("起始点相同,请重新设置")
			$(".searchPathFailBox").fadeIn()
			return
		} else {
			floorsData = [];
			// console.log("1")
			$('#loadings').css({
					'display': 'block'
				}).children('.load_xun').css({
					display: 'block'
				})
				.siblings().css({
					display: 'none'
				})
			if ($('.setPoint1').css('display') == 'none') {
				$('.setPoint1').show()
			}
			self.map.searchPath(function (msg) {
				isPathGo = true;
				if (msg.type == 'done') {
					object.distance = msg.dis
					self.map.areaClickEmbed = false;

					$(".swiper-wrapper1 li button").each(function (i) {
						var arr = {}
						arr.floorsId = $(this).attr("data")
						arr.floorsNo = $(this).attr("value")
						floorsData.push(arr)
					})
					var li = ''
					var floorIDsRe = msg.floorIDs.reverse()
					// console.log(floorIDsRe);
					for (let i = 0; i < floorIDsRe.length; i++) {
						for (let j = 0; j < floorsData.length; j++) {
							if (floorIDsRe[i] == floorsData[j].floorsId) {
								li = li + '<li  class="floorToggleUl_List" id="floorToggleUl_List">' +
									'<i class="floorToggleMinUl_i"></i><button name="btn" data="' + floorsData[j].floorsId + '" value="' + floorsData[j].floorsNo + '" id ="' + floorsData[j].floorsNo + '" >' + floorsData[j].floorsNo + '</button>' +
									'</li>'
							}
						}
					}
					$(".floorToggle,.changeFBox").hide()
					$(".floorToggleMinUl").append(li)
					$(".floorToggleMinUl li").eq(-1).show().removeClass().addClass('floorToggleUl_List-active')
					$(".floorToggleMinUl li").eq(-1).attr('data', 'isMark')
					if (floorIDsRe.length == 1) {} else {
						for (let j = 0; j < floorIDsRe.length; j++) {
							$(".floorToggleMinUl li").eq(j + 1).find('i').show()
						}
						$(".floorToggleMinUl li").eq(-1).find('i').show().removeClass().addClass("floorToggleMinUl_iR")
					}
					floorJudgment()
					if (object.moFloorid.start == object.moFloorid.end) {
						self.map.setPolarAngle(0);
					} else {
						self.map.setPolarAngle(0);
						self.map.setAzimuthalAngle(50);
						$('.looking').hide()
					}

					self.map.showFloors([msg.floorIDs.pop().toString()])
					// self.map.zoomLevel(10);
					object.isFind = true;
					// realdistance = Math.ceil(msg.dis / 50)
					object.distance = msg.dis;
					$('#loadings,.looking').css('display', 'none')
					$('#loadings').hide()
					object.ispoint = true;
				} else {
					$('#loadings').css('display', 'none')
					$(".searchPathFailBox").fadeIn()
					return;
				}
				$('.waiting').hide()
			})
			object.flagClearInterval = false;
			object.ispathGoer = false;
		}
		// } else {
		//   return;
		// }
	}
	$(".floorToggle").hide();
	$(".floorToggleUlBox").hide();
	$(".floorToggleMinUl").show();
}




// 在继续导航内的 isPause == truen内调用
function goOnInside() {
	// console.log(nowFloorId)
	self.map.showFloors([nowFloorId])
	// console.log(floorCounter)
	// console.log(object.flooridFloors[nowFloorId])
	var ffFloorNo = object.flooridFloors[nowFloorId]
	// console.log(ffFloorNo)
	// console.log(fFloor)
	if (fFloor == lFloor && floorCounter > 0) {
		// console.log("1")
		if (ffFloorNo == fFloor && ffFloorNo == lFloor) {
			// console.log("2")
			$(".floorToggleMinUl li").eq(2).show().removeClass().addClass('floorToggleUl_List-active')
			$(".floorToggleMinUl li").eq(2).siblings().show().removeClass().addClass('floorToggleUl_List')
			// $(".floorToggleMinUl li").eq(ffIndex).find('i').show()
			$(".floorToggleMinUl li").eq(2).find('i').removeClass().addClass("floorToggleMinUl_iR")
			$(".floorToggleMinUl li").eq(2).siblings().find('i').removeClass().addClass("floorToggleMinUl_i")
		} else if (ffFloorNo !== fFloor && ffFloorNo !== lFloor && ffFloorNo == mFloor) {
			var ffIndex = searchKeys(ffFloorNo, arrT)
			// console.log("3")
			$(".floorToggleMinUl li").eq(ffIndex).show().removeClass().addClass('floorToggleUl_List-active')
			$(".floorToggleMinUl li").eq(ffIndex).siblings().show().removeClass().addClass('floorToggleUl_List')
			// $(".floorToggleMinUl li").eq(ffIndex).find('i').show()
			$(".floorToggleMinUl li").eq(ffIndex).find('i').removeClass().addClass("floorToggleMinUl_iR")
			$(".floorToggleMinUl li").eq(ffIndex).siblings().find('i').removeClass().addClass("floorToggleMinUl_i")
		}
	} else if (fFloor !== lFloor) {
		var ffIndex = searchKeys(ffFloorNo, arrT)
		// console.log("4")
		$(".floorToggleMinUl li").eq(ffIndex).show().removeClass().addClass('floorToggleUl_List-active')
		$(".floorToggleMinUl li").eq(ffIndex).siblings().show().removeClass().addClass('floorToggleUl_List')
		// $(".floorToggleMinUl li").eq(ffIndex).find('i').show()
		$(".floorToggleMinUl li").eq(ffIndex).find('i').removeClass().addClass("floorToggleMinUl_iR")
		$(".floorToggleMinUl li").eq(ffIndex).siblings().find('i').removeClass().addClass("floorToggleMinUl_i")
	}
}


// 在模拟导航结束方法和取消方法调用
function moEndClear() {
	object.startP = '';
	object.endP = '';
	object.startPP = '';
	object.endPP = '';
	object.isFind = false
	isPathGo = false;
	$(".floorToggle").show()
	$('.floorToggleUlBox').hide()
	$(".floorToggleUl li").show()
	$(".floorToggleMinUl li button").removeAttr("disabled");
	$('.floorToggleMinUl').children().remove()
	if (nowFloorId) {
		console.log(nowFloorId)
		$('.floorToggle').html("" + object.flooridFloors[nowFloorId] + "")
		$('.looking').css('display', 'block').find('span').html('正在查看 ' + object.flooridFloors[nowFloorId] + '');
	}
	if (object.moFloorid.start) {
		$('.floorToggle').html("" + object.flooridFloors[object.moFloorid.start] + "")
		$('.looking').css('display', 'block').find('span').html('正在查看 ' + object.flooridFloors[object.moFloorid.start] + '');
	}
	if (floorKey) {
		console.log(floorKey)
		$('.floorToggle').html("" + floorKey + "")
		$('.looking').css('display', 'block').find('span').html('正在查看 ' + floorKey + '');
	}
	$('.scale,.floorToggle,.floorToggleMinUl').css('bottom', '.6rem');
	$(".floorToggleUlBox").css('bottom', '.4rem');
	self.map.areaClickEmbed = true;
}

// 在返回方法goback内调用
function goBackInside() {
	$(".floorToggleMinUl li button").removeAttr("disabled");
	$('.floorToggleMinUl').children().remove()
	$(".floorToggleMinUl li").eq(fIndex).find('i').hide()
	$(".floorToggleMinUl li").eq(mIndex).find('i').hide()
	$(".floorToggleMinUl li").eq(lIndex).find('i').hide()
	fFloor = "";
	mFloor = "";
	lFloor = "";
	fFloorid = ""
	mFloorid = ""
	lFloorid = ""
	fIndex = "";
	mIndex = "";
	lIndex = "";
	object.startP = '';
	object.endP = '';
	object.startPP = '';
	object.endPP = '';
	// self.map.areaClickEmbed = true;
	$(".floorToggleMinUl").hide()
	$(".floorToggle").show()
	$('.floorToggleUlBox').hide()
	$(".floorToggleUl li").show()
	$(".floorToggle").html(textO)
	$('.floorToggle,.floorToggleMinUl').css('bottom', '.6rem');
	$(".floorToggleUlBox").css('bottom', '.4rem');
	isPathGo = false;
}

// 起点终点置换方法内调用
function reverseInside() {
	$('.floorToggleMinUl').children().remove()
	if (msgLength > 1) {
		var bbc
		bbc = fIndex;
		fIndex = lIndex;
		lIndex = bbc;
	} else if (msgLength == 1) {
		$(".floorToggleMinUl").show()
		$(".floorToggle").hide()
	}
	$(".floorToggleMinUl li").css("display", "block")
}


function replaceUrl($url) {
	var url = $url
	console.log('object.mark :', object.mark);
	if (url.indexOf('?') == -1) {
		if (object.floorid) {
			url = url + '?floorid=' + object.floorid;
		}
		if (object.mark) {
			url = url + '&mark=' + object.mark
		}
		if (object.pointmove != {}) {
			url = url + '&pointmove=' + JSON.stringify(object.pointmove)
		}

	} else {
		if (url.indexOf('mark') == -1) {
			url = url + '&mark=' + object.mark
		} else {
			if (object.mark) {
				url = replaceArg(url, 'mark', object.mark);
			}
		}
		if (url.indexOf('floorid') == -1) {
			url = url + '&floorid=' + object.floorid
		} else {
			if (object.floorid) {
				url = replaceArg(url, 'floorid', object.floorid);
			}
		}

		if (url.indexOf('pathfinding') == -1) {
			return url;
		}

		if (object.pointmove != {}) {
			url = replaceArg(url, 'pointmove', JSON.stringify(object.pointmove))
		}

	}

	console.log('url :', url);
	return url

}


window.addEventListener("orientationchange", function () { //window.orientation为0,90，-90

	//0为竖屏模式（portrait），-90意味着该设备横向旋转到右侧的横屏模式（landscape），而90表示该设备是横向旋转到左边的横屏模式（landscape）
	if(window.orientation != 0){
		alert('竖屏体验更佳，请竖屏体验');
	}
}, false);